Skip to content

feat: on the fly thumbnail generation#3523

Merged
isekovanic merged 18 commits intodevelopfrom
feat/thumbnail-generation
Apr 1, 2026
Merged

feat: on the fly thumbnail generation#3523
isekovanic merged 18 commits intodevelopfrom
feat/thumbnail-generation

Conversation

@isekovanic
Copy link
Copy Markdown
Contributor

🎯 Goal

This PR adds native video thumbnail generation for local assets and wires it into the attachment flows. The rationale' behind the PR is the fact that starting RN 0.84 and onwards, ImageBackground can no longer reliably render ph:/// video assets on iOS (and probably other edge cases too).

Thumbnails are now generated natively on iOS and Android for local video assets coming from the attachment picker / image picker / camera flows, cached in the app cache directory, and reused if they were already generated before. The native API is batched, so we can generate multiple thumbnails in one go instead of doing them one by one. The module only handles local assets. If thumbnail generation fails for a single video, we soft fail that item only and fall back to the existing placeholder / no thumbnail UI instead of failing the whole batch.

So in other words:

  • added native video thumbnail generation on iOS and Android under shared-native
  • exposed it through a new TurboModule StreamVideoThumbnail API
  • batched thumbnail generation for getPhotos, pickImage, and takePhoto
  • added deterministic cache reuse for generated thumbnails
  • limited concurrent native generation to avoid decode storms
  • made thumbnail generation best-effort per item:
    • native returns { uri, error } per requested asset
    • failed items no longer fail the whole batch
  • restricted thumbnail generation for local assets only
    • Android: raw path, file://, content://
    • iOS: raw path, file://, ph://
  • switched attachment picker items and image upload previews away from ImageBackground to plain Image

Notes

  • this is new architecture only
  • thumbnails are written to the app cache dir, so they can survive relaunches but are still disposable cache
  • existing cached thumbnails from the old cache folder name will not be reused

🛠 Implementation details

🎨 UI Changes

iOS
Before After
Android
Before After

🧪 Testing

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@isekovanic isekovanic requested a review from oliverlaz March 31, 2026 22:23
@Stream-SDK-Bot
Copy link
Copy Markdown
Contributor

Stream-SDK-Bot commented Mar 31, 2026

SDK Size

title develop branch diff status
js_bundle_size 346 KB 347 KB +1546 B 🔴

@isekovanic isekovanic merged commit 76a6e6b into develop Apr 1, 2026
3 of 5 checks passed
@isekovanic isekovanic deleted the feat/thumbnail-generation branch April 1, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants